﻿using System;
using Microsoft.AspNetCore.Mvc;
using studentSubsidy.Entity;
using studentSubsidy.Entity.AdminProject;
using studentSubsidy.Service;

namespace studentSubsidy.Controllers
{
    [ApiController]
    [Route("api/adminProject/[Action]")]
    public class AdminProject :Controller
    {
        private AdminProjectService _adminProjectService = new AdminProjectService();
        
        [HttpGet(Name = "getProjectList")]
        public Result GetProjectList([FromQuery] string role)
        {
            return _adminProjectService.getProjectList(role);
        }
        
        [HttpPost(Name = "addProject")]
        public Result AddProject([FromBody] AddProjectQuery updateProjectQuery)
        {
            return _adminProjectService.addProject(updateProjectQuery);
        }
        
        [HttpGet(Name = "getProjectInfo")]
        public Result GetProjectInfo([FromQuery] int product_id)
        {
            return _adminProjectService.getProjectInfo(product_id);
        }
        
        [HttpPost(Name = "updateProjectInfo")]
        public Result UpdateProjectInfo([FromBody] UpdateProjectQuery updateProjectQuery)
        {
            return _adminProjectService.updateProjectInfo(updateProjectQuery);
        }
    }
}